home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / C++ A'Link Files / Jan 91 / CPlus.Dev$ 1⁄18⁄91 / 0256-CFront PascalObject -Jan91 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.5 KB  |  63 lines  |  [TEXT/GEOL]

  1. Item    1937673                         15-Jan-91        14:12PST
  2.  
  3. From:   KNEPPER                         Knepper, Christopher
  4.  
  5. To:     CPLUS.DEV$                      C++ Interest List--Developers
  6.         MACAPP.TECH$                    MacApp Technical
  7.         CPLUS.APPLE$                    C++ Interest List--Apple Employees
  8.  
  9. Item forwarded by       SPA.DTS      to SPA0144 
  10.  
  11. Item forwarded by       FRED.FORSMAN to CPLUS.BUGS 
  12.  
  13.  
  14. ------------------------------------------------------------------------------
  15.  
  16. Sub:    CFront: PascalObject bug!
  17.  
  18. TWIMC:
  19.  
  20. There is a serious bug in CFront in the implementation of PascalObject.
  21. Whenever a virtual member function is called from within the "lowest"
  22. implementation of that function, the function is not called polymorphically.
  23.  
  24. -Chris
  25.  
  26. Example follows:
  27.  
  28. class TParent : public PascalObject {
  29.   public:
  30.    TParent *fMember;
  31.  
  32.    virtual pascal void VirtualMemberFunction();
  33. };
  34.  
  35. class TChild : public TParent {
  36.   public:
  37.  
  38.    virtual pascal void VirtualMemberFunction();
  39. };
  40.  
  41.  
  42. pascal void TParent::VirtualMemberFunction(void)
  43. {
  44.    fMember->VirtualMemberFunction();  // BUG occurs here!
  45. }
  46.  
  47. pascal void TChild::VirtualMemberFunction(void)
  48. {
  49.    fMember->VirtualMemberFunction();   // calls TParent$VirtualMemberFunction
  50. }
  51.  
  52.    /* NOTE: Bug. In TParent::VirtualMemberFunction, the call
  53.   *     fParent->VirtualMemberFunction();
  54.   *
  55.   * generates a call to:
  56.     *  TParent_VirtualMemberFunction( (*this)-> fParent) ;
  57.     *
  58.     * it should generate a call to:
  59.     *  TParent$VirtualMemberFunction( (*this)-> fParent) ;
  60.     */
  61.  
  62.  
  63.